
const http = require('http');

const { createServer } = http;

// var server = createServer(function (req,res) { });
var server = createServer();

server.on("request", function (req, res) {
    // req -> 请求相关的信息
    if (req.url != "/favicon.ico") {
        console.log("接收前端发送的请求");
        // console.log(req);
        // console.log(req.method, req.url);
        // console.log(req.headers);

        res.end("2222");
    } else {
        res.end();
    }



})


server.listen(3000, function () {
    console.log("服务器启动成功localhost:3000");
})

